#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv){
	int num_stud;

	while(scanf("%d", &num_stud)==1 && num_stud != 0){
		int i;
		double *paid_stud = (double *)malloc(sizeof(double) * num_stud);
		double total, average, diff;

		total = diff = 0;
		
		for(i = 0; i < num_stud; i++){
			scanf("%lf", &paid_stud[i]);
			paid_stud[i] = (double)((int)(paid_stud[i]*100));
			total += paid_stud[i];
		}

		average = total / num_stud;

		for(i = 0; i < num_stud; i++)
			if(paid_stud[i] > average){
				diff += (double)((int)(paid_stud[i] - average))/100;
			}

		printf("$%.2lf\n", diff);
		
		//printf("%lf\n", diff);
	}
	return(0);
}